* This script contains the code to replicate Table 1 in Ductor, L., Fafchamps, M., Goyal S. and M. van der Leij. Social Networks and Research Output. The Review of Economics and Statistics.
clear all
log using Table1.log, replace
use prodndnp_fullsample.dta
order auth year t tsq lcprod5 lcprodl5 lprodf3 lprodf3l-lprodf3l15 prod prodf5 qnt cprod cprod5 cprodl5 mnauthors ystart yend nopapers group prodf3 degree1y degree2y degree3y degree4y degree5y degree6y degree7y degree8y degree9y degree10y degree11y degree12y degree13y degree14y degree15y degree21y degree22y degree23y degree24y degree25y degree26y degree27y degree28y degree29y degree210y degree211y degree212y degree213y degree214y degree215y gc1y gc2y gc3y gc4y gc5y gc6y gc7y gc8y gc9y gc10y gc11y gc12y gc13y gc14y gc15y lnetprod1y lnetprod2y lnetprod3y lnetprod4y lnetprod5y lnetprod6y lnetprod7y lnetprod8y lnetprod9y lnetprod10y lnetprod11y lnetprod12y lnetprod13y lnetprod14y lnetprod15y lnetprod21y lnetprod22y lnetprod23y lnetprod24y lnetprod25y lnetprod26y lnetprod27y lnetprod28y lnetprod29y lnetprod210y lnetprod211y lnetprod212y lnetprod213y lnetprod214y lnetprod215y lbet1y lbet2y lbet3y lbet4y lbet5y lbet6y lbet7y lbet8y lbet9y lbet10y lbet11y lbet12y lbet13y lbet14y lbet15y

/* Table 1: Summary Statistics*/
sum lprodf3 lcprod5 lcprodl5 degree5y degree25y gc5y lclos5y lbet5y lnetprod5y lnetprod25y neiq15y 
corr lprodf3 lcprod5 lcprodl5 degree5y degree25y gc5y lclos5y lbet5y lnetprod5y lnetprod25y neiq15y 

log close

/* Figure 1 and 2*/
gen random=runiform()
sort random
gen n=_n
twoway (lfitci lprodf3 lnetprod5y) (scatter lprodf3 lnetprod5y, sort) if lnetprod5y>0 & n<1000,xtitle(Coauthors' productivity) 
twoway (lfitci lprodf3 lcprod5) (scatter lprodf3 lcprod5, sort) if lcprod5>0 & n<1000,xtitle(Recent Output) 
twoway (lfitci lprodf3 lclos5y) (scatter lprodf3 lclos5y, sort) if lclos5y>0 & n<1000,xtitle(Closeness Centrality) 

